#ifndef GAME_TIMER_H_
#define GAME_TIMER_H_

/*
	* GameTimer
	* To do animation correctly, we need to keep the track of the time.
	  In particular, we need to measure the amount of time that elapses between frames for animation.
	  If frame rates are high, the time intervals between frames will be very short, therefore we 
	  need timer with high level of accuracy.

	* GameTimer class maintains the entire game time that has passed, also it provides various
	  utility functions such as Start() for starting the timer, Stop() to stop the timer, 
	  Reset() to reset the timer, Tick() for the next timer tick we want.

	* There are 2 important functions that we are using in the GameTimer class.
		- QueryPerformanceCounter() - This performance timer measures time in units called Count.
		- QueryPerformaceFrequency() - To get frequency( counts per second ) of performace timer.
	  Both these functions are provided to us in Windows.hs

	* Created by : Varun Tyagi
*/

class GameTimer
{
public:

/* Constructor and Destructor. */
	GameTimer();
	~GameTimer();

/* Member functions. */

	/* Get the current game time in seconds. */
	float GetGameTime( void ) const;

	/* Get time between the current and the last frame in seconds. */
	float GetDeltaTime( void ) const;

	/* Call only once before the message loop to reset the timer. */
	void Reset( void );

	/* When the timer is unpaused. */
	void Start( void );

	/* When the timer is stopped/paused. */
	void Stop( void );

	/* Tick to get every frame that has passed. */
	void Tick( void );

private:

/* Member variables. */

	double	m_dSecondsPerCount;
	double	m_dDeltaTime;

	__int64	m_i64BaseTime;
	__int64	m_i64PauseTime;
	__int64	m_i64StopTime;
	__int64	m_i64PrevTime;
	__int64	m_i64CurrTime;

	bool	m_bStopped;
};


#endif